#pragma once

#include "GraphicControlMedia.h"
#include "ListFileMultiMedia.h"
#include "GraphicShowVideo.h"
#include "VideoPlayerManager.h"
#include "MediaObject.h"
#include "GraphicsFullScreenVideo.h"
#include "ShowSmallVideo.h"
#include "afxwin.h"
#include "afxcmn.h"


#define MY_TIMEREVENT 9991

// CMultiMediaDlg dialog
class CMultiMediaDlg : public CDialog
{
// Construction
public:
	CMultiMediaDlg(CWnd* pParent = NULL);	// standard constructor
	
	static CMultiMediaDlg* ShareInstance();
// Dialog Data
	enum { IDD = IDD_MULTIMEDIA_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()

public:
    //CRect m_rectParentDlg;
	CRect m_rtScreenPlayer;
	CRect GetCRectFromRECT(RECT lpRECT);
	Rect  GetRectFromRECT(RECT lpRECT);
	
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	virtual BOOL PreTranslateMessage(MSG* pMsg);


public:
	CMenu m_Cmenu;
	GraphicControlMedia       m_gControlMedia;
	ListFileMultiMedia        m_gListFileMultiMedia;
	GraphicShowVideo          m_gShowVideo;
	VideoPlayerManager        m_VideoMng, m_VideoMng2;
	ShowSmallVideo            m_smallVideo;
    
     static CString VideoType[];
	 static CString MusicType[];
	CString               m_strFileName;
    CString               m_strFilePath, m_strFilePath2,m_pathDropFile;
	int		              nCount;
	int	                  m_nVol;
	int					  m_mainDlg;
	bool	              m_bAvoidReplayWhenAddFile;
	bool				  m_bIsPlaying;
	bool				  m_bIsStop;
	bool                  m_bToggle;
	bool                  m_bChange;
	bool                  m_bNoChange;
	bool                  m_bCheckFull;
	bool                  m_changleFullScreen;
	bool                  m_Audio;
	bool                  m_checkHide;
	CString				  m_strTotalTime;
	int                   time1,time2;
	LONGLONG              cur1 ;
	LONGLONG              cur2 ;
	LONGLONG              lTimeLineUnit1;
	LONGLONG			  lTimeLineUnit2 ;
    CArray<MediaObject,MediaObject&> arrMediaObjects,arrMediaObjects2;
    
	afx_msg void OnFileOpenfile();
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	afx_msg void OnFileExit();
	afx_msg void OnControlPlayPause();
	afx_msg void OnControlStop();
	afx_msg void OnControlNext();
	afx_msg void OnControlPrevious();
	afx_msg void OnControlFullscreen();
	afx_msg void OnControlMute();
	afx_msg void OnWindowPosChanged(WINDOWPOS* lpwndpos);
	afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
	afx_msg void OnChooseOneVideo();
	afx_msg void OnShowHideVideo();
	afx_msg void OnChangevideo();
	
	LRESULT  OnDropFiles(WPARAM wParam,LPARAM lParam);

	void NextOrPrevPlayList(bool bFlag);
	void UpdateVideoScreen(void);
	void UpdateVideoScreen2(void);
	void MediaPlay();
	void MediaStop();
	void MediaVolume(int nVol);
	int  DoTimeStuff();
	BOOL CheckMultiType(CString strArray[], CString str);
	
};
